<?php

/**
 * LEAGUEMan
 * 
 * Copyright (C) 2007 Marko Bischof
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

if($this->project->getParam("allow_extra_time", 0)){
	$types = array();
	$types[] = mosHTML::makeOption(0, "regular");
	$types[] = mosHTML::makeOption(1, "extra");
	$types[] = mosHTML::makeOption(2, "penalty");
			
	$mstl = mosHTML::selectList( $types, "match_result_type[]", 'class="text_area" size="1"','value', 'text', $this->row->match_result_type );
	unset($types);
}

?>

<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}
		
		if (form.name.value == '') {
			alert( "Please fill in a name." );
		} else {
			<?php getEditorContents( 'editor1', 'summary' ) ; ?>
			submitform( pressbutton );
		}
	}
</script>

<form action="index2.php" method="POST" name="adminForm">
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td class="sectionname"><?php echo $this->project->getName() . " : " . $this->row->match_id;?></td>
		</tr>
	</table>

<?php
	$ptabs = new mosTabs( 0 );
	$ptabs->startPane( "com_leagueman" );
	$ptabs->startTab("Match","Match-page");
?>
	<table width="100%">
		<tr>
			<td width="40%" valign="top">
	<table class="adminlist">
		<tr>
			<th width="20%">&nbsp;</th>
			<th><?php echo $this->team1->getName(); ?></th>
			<th><?php echo $this->team2->getName(); ?></th>
		</tr>
		<tr class="row1">
			<td><b>Endresult</b></td>
			<td align="center"><input type="text" name="match_result_0_1" size="3" value="<?php echo $this->row->match_result_0_1; ?>" class="text_area" style="text-align: center" /></td>
			<td align="center"><input type="text" name="match_result_0_2" size="3" value="<?php echo $this->row->match_result_0_2; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr class="row0">
			<td><b>CH1</b></td>
			<td align="center"><input type="text" name="match_result_1_1" size="3" value="<?php echo $this->row->match_result_1_1; ?>" class="text_area" style="text-align: center" /></td>
			<td align="center"><input type="text" name="match_result_1_2" size="3" value="<?php echo $this->row->match_result_1_2; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr class="row1">
			<td><b>CH2</b></td>
			<td align="center"><input type="text" name="match_result_2_1" size="3" value="<?php echo $this->row->match_result_2_1; ?>" class="text_area" style="text-align: center" /></td>
			<td align="center"><input type="text" name="match_result_2_2" size="3" value="<?php echo $this->row->match_result_2_2; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr class="row0">
			<td><b>CH3</b></td>
			<td align="center"><input type="text" name="match_result_3_1" size="3" value="<?php echo $this->row->match_result_3_1; ?>" class="text_area" style="text-align: center" /></td>
			<td align="center"><input type="text" name="match_result_3_2" size="3" value="<?php echo $this->row->match_result_3_2; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr class="row1">
			<td><b>CH4</b></td>
			<td align="center"><input type="text" name="match_result_4_1" size="3" value="<?php echo $this->row->match_result_4_1; ?>" class="text_area" style="text-align: center" /></td>
			<td align="center"><input type="text" name="match_result_4_2" size="3" value="<?php echo $this->row->match_result_4_2; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr class="row0">
			<td><b>CH5</b></td>
			<td align="center"><input type="text" name="match_result_5_1" size="3" value="<?php echo $this->row->match_result_5_1; ?>" class="text_area" style="text-align: center" /></td>
			<td align="center"><input type="text" name="match_result_5_2" size="3" value="<?php echo $this->row->match_result_5_2; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
	</table>
			</td>
			<td valign="top">
	<table width="60%" class="adminform">
		<tr>
			<th width="25%" align="left">Details</th>
			<th>&nbsp;</th>
		</tr>
		<?php if($this->project->getParam("allow_extra_time", 0)): ?>
		<tr>
			<td><b>Result Type</b></td>
			<td><?php echo $mstl;?></td>
		</tr>
		<?php endif ?>
		<tr>
			<td><b>Result Info</b></td>
			<td><input type="text" name="match_result_detail" size="20" value="<?php echo $this->row->match_result_info; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr>
			<td><b>Venue</b></td>
			<td><input type="text" name="match_venue" size="20" value="<?php echo $this->row->match_venue; ?>" class="text_area" /></td>
		</tr>
		<tr>
			<td><b>Referee</b></td>
			<td><input type="text" name="match_referee" size="20" value="<?php echo $this->row->match_referee; ?>" class="text_area" /></td>
		</tr>
		<tr>
			<td><b>Spectators</b></td>
			<td><input type="text" name="match_venue" size="9" value="<?php echo $this->row->match_crowd; ?>" class="text_area" style="text-align: center" /></td>
		</tr>
		<tr>
			<td><b>Date / Time</b></td>
			<td>
				<input type="text" name="match_date" size="9" value="<?php echo $this->row->match_date; ?>" class="text_area" style="text-align: center" />
				<input type="text" name="match_time" size="4" value="<?php echo substr($this->row->match_time, 0, 5); ?>" class="text_area" style="text-align: center" />
			</td>
		</tr>
		<tr>
			<td><b>Show MatchInfo</b></td>
			<td><?php echo mosHTML::yesnoRadioList('match_info_flag', '', $this->row->match_info_flag );?></td>
		</tr>
		<tr>
			<td><b>Published</b></td>
			<td><?php echo mosHTML::yesnoRadioList('published', '', $this->row->published );?></td>
		</tr>
	</table>
			</td>
		</tr>
	</table>
<?php
	$ptabs->endTab();
	$ptabs->endPane();
?>

	<input type="hidden" name="match_id" value="<?php echo $this->row->match_id; ?>">
	<input type="hidden" name="option" value="com_leagueman">
	<input type="hidden" name="act" value="matches">
	<input type="hidden" name="task" value="">
	
</form>